﻿@model CNRegex.Web.Models.ModelRegexDetail
@using CNRegex.Web.Base
@{
	ViewBag.Title = "Detail";
	Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="@Url.Content("~/Content/css/RegexHomeDetail.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Scripts/syntaxhighlighter/shCore.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Scripts/syntaxhighlighter/shThemeDefault.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/syntaxhighlighter/shCore.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/syntaxhighlighter/shBrushCSharp.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/kindeditor/kindeditor-min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/common.js")" type="text/javascript"></script>
<script type="text/javascript">
	$(document).ready(function () {
		registerKindeditor("Comment");
		SyntaxHighlighter.all()
	}
	);
</script>
<h2>
	@Model.CurrentExpression.Title
</h2>

<div class="rhDetail_leftConent">
	<div class="rhDetail_expressionContainer">
	<table>
		<colgroup>
			<col width="10%" />
			<col />
		</colgroup>
		<tr>
			<td class="rhDetail_tdText">
				表达式
			</td>
			<td>
				<div class="rhDetail_expressionContent">@Model.CurrentExpression.Expression</div>
			</td>
		</tr>
		<tr>
			<td class="rhDetail_tdText">
				描述
			</td>
			<td>
				<div>@Model.CurrentExpression.Description</div>
			</td>
		</tr>
		<tr>
			<td class="rhDetail_tdText">
				<div class="rhDetail_txt_matches">
					匹配</div>
			</td>
			<td>
				<div class="rhDetail_matches">
					<ul>
								 @{
									var matches = Model.CurrentExpression.Matches.Split(new string[]{"|||"}, StringSplitOptions.RemoveEmptyEntries);
								}
								@for (int i = 0; i < matches.Length; i++)
								{
									<li>@matches[i]</li>
								}
								</ul>
				</div>
			</td>
		</tr>
		<tr>
			<td class="rhDetail_tdText">
				<div class="rhDetail_txt_nonmatches">
					不匹配
				</div>
			</td>
			<td>
				<div class="rhDetail_nonmatches">
					<ul>
							@{
								var nonMatches = Model.CurrentExpression.NonMatches.Split(new string[] { "|||" }, StringSplitOptions.RemoveEmptyEntries);
						}
						@for (int i = 0; i < nonMatches.Length; i++)
						{
							<li>@nonMatches[i]</li>
						}
						</ul>
				</div>
			</td>
		</tr>
		<tr>
			<td class="rhDetail_tdText">
				作者
			</td>
			<td>
				<div class="rhDetail_author">
					<a href="/@Model.ExpressionCreator.Name">@Model.ExpressionCreator.Name</a>
				</div>
			</td>
		</tr>
	</table>
</div>
	<div class="site_comments">
	<h2 class="t_h2">评论:</h2>
	@using (Html.BeginForm("Comment","RegexHome"))
	{
		if (FrontContext.CurrentRegexUser == null)
		 {
				<div class="site_comment_account">请您先 <a href="/account/login">登录</a> ,如果您没有帐号,请先 <a href="/account/register">注册</a></div>
		 }
		 else
		 {
				<div class="rhDetail_comment_input">
					@Html.TextArea("Comment", new { style="height:150px;"})
				</div>
				@Html.Hidden("ExpressionID", Model.CurrentExpression.ID)
				<input type="submit" value="发表评论" class="site_submit" />
		 }
	}

	<ul>
		@for (int i = 0; i < Model.CurrentExpressionComments.Count(); i++)
		{
			<li>
				<span class="site_comment_serial">@(i+1)</span>
				<a href="/@Model.CurrentExpressionComments[i].RegexUserName">@Model.CurrentExpressionComments[i].RegexUserName</a>
				<span class="site_comment_date">发表于 : @Model.CurrentExpressionComments[i].CommentDate.ToString("yyyy-MM-dd hh:mm:ss")</span>
				<div class="site_comment_content">
					@(new HtmlString(Model.CurrentExpressionComments[i].Comment))
				</div>
				
			</li>
		}
	</ul>
	@{
		Html.RenderPartial("/Views/Controls/Paginate.cshtml",Model.Paginate);
	}
	
</div>
</div>


